package com.qing.api.service;

import com.qing.api.pojo.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

// 降级
@Component
public class UserClientServiceFallbackFactory implements FallbackFactory {

    @Override
    public UserClientService create(Throwable throwable) {
        return new UserClientService(){
            @Override
            public void addUse(User user) {

            }

            @Override
            public User queryById(Long id) {
                return new User().setName("UserClientServiceFallbackFactory").setDbSource("数据不存在");
            }

            @Override
            public List<User> queryUser(String name) {
                return null;
            }
        };
    }
}
